//
//  ZYYHotViewController.m
//  WonderfulGift
//
//  Created by Zhai on 15/12/28.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "TTSAppToolsAFN.h"
#import "AFNetworking.h"
@implementation TTSAppToolsAFN


+ (void)getDataWithAFNurl:(NSString *)urlStr block:(AppToolsBlock)block errorBlock:(AppToolsErrorBlock)errorBlock{
    // 创建管理者
    AFHTTPRequestOperationManager* manager = [AFHTTPRequestOperationManager manager];
    // 判断数据类型
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain",@"text/json",@"application/json",@"text/javascript",@"text/html",nil];
    // 调用get方法
    [manager GET:urlStr parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        //        NSLog(@"使用AFN进行get请求 ===  %@",responseObject);
        
        // 回调
        block(responseObject);
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
        NSLog(@"失败==== %@",error);
        
        // 失败时回调
        errorBlock(error);
        
    }];
    
    
    
    
}


@end
